<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AdminAuthController;
use App\Http\Controllers\BillTypeController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::get('/admin/{any}', function () {
    return view('welcome'); // 指向入口文件
})->where('any', '.*');
// 在现有路由组外添加
Route::prefix('admin')->group(function () {
    Route::post('login', [AdminAuthController::class, 'login']);
    Route::post('register', [AdminAuthController::class, 'register']);
    
    Route::middleware(['jwt.auth', 'admin'])->group(function () {
        Route::post('logout', [AdminAuthController::class, 'logout']);
        
        // 账单类型路由
        Route::prefix('billtype')->group(function () {
            Route::post('/store', [BillTypeController::class, 'store']);
            Route::get('/list', [BillTypeController::class, 'index']);
        });
    });
});
